'use strict'

const fs = require('fs')
const path = require('path')

exports.error = function (directory,response) {
    fs.readFile(path.join(directory + '/404.html'), (err, data) => {
        if (err) {
            console.error(err.message)
        } else {
            response.writeHead(404, { 'Content-Type': 'text/html' })
            response.write(data)
            response.end()
        }
    })
}
